package cn.qyd.javathread;

/**
 * @author 邱运铎
 * @date 2024-03-14 13:10
 */
public class RunnableThreadDemo1 implements Runnable{
    @Override
    public void run() {
        for (int i=0; i < 100; i++) {
            if (i == 10) {
                System.out.println(10);
            }
            System.out.println(Thread.currentThread().getName() + "------------------" + i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Runnable runnable = new RunnableThreadDemo();
        Thread thread1 = new Thread(new RunnableThreadDemo1());
        Thread thread2 = new Thread(runnable);
        Thread thread3 = new Thread(runnable);
        thread1.setDaemon(true);
        thread2.setDaemon(true);
        thread1.start();
        thread2.start();
        Thread.sleep(1000);
        thread3.start();
    }
}
